package com.littleII.util;

import java.text.ParseException;
import java.util.Date;

import org.apache.commons.lang.time.DateUtils;

public class DateUtil {
	public static Date StringToDate(String dateStr) {
		String[] pattern = new String[] { "yyyy-MM", "yyyyMM", "yyyy/MM",
				"yyyyMMdd", "yyyy-MM-dd", "yyyy/MM/dd", "yyyyMMddHHmmss",
				"yyyy-MM-dd HH:mm:ss", "yyyy/MM/dd HH:mm:ss" };
		try {
			return DateUtils.parseDate(dateStr, pattern);
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}
}
